
import { exec } from 'child_process';
function startProcess() {
  const appProcess = exec('node pull_audio.cjs');

  appProcess.stdout.on('data', (data) => {
    console.log(`[APP] ${data}`);
  });

  appProcess.stderr.on('data', (data) => {
    console.error(`[ERROR] ${data}`);
  });

  appProcess.on('exit', (code) => {
    console.error(`[CRASH] 退出码 ${code}, 3秒后重启...`);
    setTimeout(startProcess, 3000);
  });

  return appProcess;
}

startProcess();
